package com.luych.toolbox.common.feign.view.data.service;

import com.luych.toolbox.common.enums.DataTransporterHistoryStatus;
import com.luych.toolbox.common.feign.FeignView;
import com.luych.toolbox.common.feign.view.base.service.UserView;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.util.Map;

@ApiModel("数据同步历史")
public class DataTransporterHistoryView extends FeignView {

    @ApiModelProperty("来源数据源")
    private DataSourceView dataSourceFrom;
    @ApiModelProperty("目标数据源")
    private DataSourceView dataSourceTo;
    @ApiModelProperty("数据同步计划")
    private DataTransporterPlanView dataTransporterPlan;
    @ApiModelProperty("描述")
    private String name;
    @ApiModelProperty("数据表对应关系")
    private Map<String, String> tables;
    @ApiModelProperty("状态")
    private DataTransporterHistoryStatus status;
    @ApiModelProperty("异常信息")
    private String errorMessage;
    @ApiModelProperty("异常堆栈")
    private String errorTrace;
    @ApiModelProperty("责任人")
    private UserView owner;
    @ApiModelProperty("开始时间")
    private Date startDate;
    @ApiModelProperty("结束时间")
    private Date completeDate;

    public DataSourceView getDataSourceFrom() {
        return dataSourceFrom;
    }

    public String getDataSourceFromId() {
        return dataSourceFrom == null ? null : dataSourceFrom.getId();
    }

    public void setDataSourceFrom(DataSourceView dataSourceFrom) {
        this.dataSourceFrom = dataSourceFrom;
    }

    public DataSourceView getDataSourceTo() {
        return dataSourceTo;
    }

    public String getDataSourceToId() {
        return dataSourceTo == null ? null : dataSourceTo.getId();
    }

    public void setDataSourceTo(DataSourceView dataSourceTo) {
        this.dataSourceTo = dataSourceTo;
    }

    public DataTransporterPlanView getDataTransporterPlan() {
        return dataTransporterPlan;
    }

    public String getDataTransporterPlanId() {
        return dataTransporterPlan == null ? null : dataTransporterPlan.getId();
    }

    public void setDataTransporterPlan(DataTransporterPlanView dataTransporterPlan) {
        this.dataTransporterPlan = dataTransporterPlan;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<String, String> getTables() {
        return tables;
    }

    public void setTables(Map<String, String> tables) {
        this.tables = tables;
    }

    public DataTransporterHistoryStatus getStatus() {
        return status;
    }

    public void setStatus(DataTransporterHistoryStatus status) {
        this.status = status;
    }

    public String getStatusValue() {
        return status == null ? null : status.getValue();
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public String getErrorTrace() {
        return errorTrace;
    }

    public void setErrorTrace(String errorTrace) {
        this.errorTrace = errorTrace;
    }

    public UserView getOwner() {
        return owner;
    }

    public void setOwner(UserView owner) {
        this.owner = owner;
    }

    public String getOwnerId() {
        return owner == null ? null : owner.getId();
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getCompleteDate() {
        return completeDate;
    }

    public void setCompleteDate(Date completeDate) {
        this.completeDate = completeDate;
    }
}
